import java.util.Arrays;

public class demo02 {
    //手套
    public int findMinimum(int n, int[] left, int[] right) {
        int leftsum=0;
        int rightsum=0;
        int sum=0;
        int leftmin=Integer.MAX_VALUE;
        int rightmin=Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if(left[i]*right[i]==0){
                sum+=left[i]+right[i];
            }else{
                leftsum+=left[i];
                rightsum+=right[i];
                leftmin=Math.min(leftmin,left[i]);
                rightmin=Math.min(rightmin,right[i]);
            }
        }
        return Math.min(leftsum-leftmin+1,rightsum-rightmin+1)+1+sum;
    }

//    4
//    01   7  6  1    1+8
//    10   5  6  2  1+1
}
